<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JavaScript运算符与表达式</title>
</head>
<body>
    <h1>JavaScript运算符与表达式</h1>
    <script>
        //赋值
        let a = 1;
        let b = 2;

        //运算符
        let sum = a + b;
        sum += 1; 
        console.log(sum);

        //求余运算
        console.log(3%2);
        console.log(3.2%2);

        //解构运算符
        let [v1,v2,v3] = [1,2,3];
        console.log(v1);

        //比较运算符  相等(==)与不等(!=)以及严格相等(===)与严格不等(!==)
        console.log(1 == "1");
        console.log(1 === "1");
        console.log(1 == true);
        console.log(1 === true);

        console.log(3 > 2);
        console.log(3 > "2");
        console.log(3 > "a");

        //逻辑运算符 短路运算  逻辑与(&&)  逻辑或(||)  逻辑非(!)
        console.log(a >= 1 && b < 2);
        console.log(a === 1 ? "是" : "否");

        //位运算
        console.log(a&b);

        //字符串连接运算符 +
        console.log("a=" + a);

        console.log(typeof a);

    </script>
    <a href="javascript:void(0)">无点击效果</a>
</body>
</html>